package com.itheima.method;

/**
 * @Author 王加鑫
 * @Date 2021/4/22 10:17
 * @Version 1.0
 * 思考需求:定义一个方法,求任意一个数四舍五入后的结果并打印,在主方法中调用测试
 */
public class MethodDemo02 {
    public static void main(String[] args) {
        numTest(3.5);


    }

    public static void numTest(double num){
        int i = (int) num;
        //四舍五入后的结果
        int num1 = 0;
        if(num - i >= 0.5){
           num1 = i+1;
        }else {
           num1 = i;
        }
        System.out.println(num1);

    }
}
